import request from '@/utils/request'

/**
 * 获取商品信息
 * @param {String} id
 * @returns
 */
export const findGoods = id => {
  return request('/goods', 'get', { id })
}

/**
 * 获取商品同类推荐
 * @param {String} id
 * @param {Number} limit
 * @returns
 */
export const findRelGoods = (id, limit = 16) => {
  return request('/goods/relevant', 'get', { id, limit })
}

/**
 * 获取热榜商品
 * @param {*} param0
 * @returns
 */
export const findHotGoods = ({ id, type, limit = 3 }) => {
  return request('/goods/hot', 'get', { id, type, limit })
}

/**
 * 获取商品的评价统计信息
 * @param {String} id
 * @returns
 */
export const findCommentInfoByGoods = id => {
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`, 'get')
}

/**
 * 查询商品评价列表
 * @param {*} id
 * @param {*} params
 * @returns
 */
export const findGoodsCommentList = (id, params) => {
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`, 'get', params)
}

/**
 * 获取商品的specs和skus
 * @param {*} skuId
 * @returns
 */
export const getSpecsAndSkus = skuId => {
  return request(`/goods/sku/${skuId}`, 'get')
}
